/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/enums/MatchMode.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: MatchMode.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (周一, 02 七月 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.dao.enums;

/**
 * @author elancom
 * @date Apr 13, 2012
 */
public enum MatchMode {
	DEFAULT, ANY, START, END, EXACT;

	public String toMatch(String pattern) {
		String matchString;
		switch (this) {
		case DEFAULT:
			matchString = "%" + pattern + "%";
			break;
		case ANY:
			matchString = "%" + pattern + "%";
			break;
		case START:
			matchString = pattern + "%";
			break;
		case END:
			matchString = "%" + pattern;
			break;
		case EXACT:
			matchString = pattern;
			break;
		default:
			matchString = pattern;
			break;
		}

		return matchString;
	}
}
